<template>
  <div class="school">
    <h2>学校名称: {{name}}</h2>
    <h2>学校地址: {{address}}</h2>
    <button @click="sendSchoolMessage">点我传递学校信息</button>
  </div>
</template>

<script>
  export default {
    name: 'student-name',
    props: ['getSchoolMessage'],
    data() {
      return {
        name: '千锋教育',
        address: '北京昌平',
      }
    },
    methods: {
      sendSchoolMessage() {
        this.getSchoolMessage(this.name,this.address)
      }
    }
  }
</script>

<style scoped>
  .school {
    background-color: skyblue;
    padding: 10px;
    margin: 10px;
  }
</style>